/**
 * 
 */
package com.autosalon.ui.spravaPujcek.action;

import com.autosalon.ui.spravaPujcek.SpravaPujcek;
import com.autosalon.ui.spravaPujcek.state.SpravaPujcekStateHolder;
import com.vaadin.ui.Button.ClickEvent;

/**
 * @author Ragisel
 *
 */
public class BackButtonAction extends AbstractSpravaPujcekAction{

	public BackButtonAction(SpravaPujcek spravaPujcek) {
		super(spravaPujcek);
	}

	@Override
	public void buttonClick(ClickEvent event) {
		int id;
		try{
			id = spravaPujcek.getSwitcher().getMainWindow().getZakaznik().getRole().getId().intValue();
		}catch (NullPointerException e) {
			id = 1;
		}
		SpravaPujcekStateHolder.setState(SpravaPujcekStateHolder.VIEW_PUJCKY_STATE,id, spravaPujcek);
		
	}

	


}
